Heuristic aware garbage collection scheme in storage systems

ABSTRACT

The various implementations described herein include systems, methods and/or devices used to enable heuristic aware garbage collection in storage systems (e.g., non-volatile data storage systems using one or more flash memory devices). In one aspect, a time parameter (e.g., dwell time) and/or heuristics (e.g., error count, error rate, number of reads, number of times programmed, etc.) are used in a garbage collection scheme. For example, in some implementations, the method of garbage collection for a storage medium in a storage system includes (1) determining a time parameter for a block in the storage medium, and (2) in accordance with a determination that the time parameter for the block is greater than a first threshold time, enabling garbage collection of the block.

RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Application No. 61/870,166, filed on Aug. 26, 2013, which is incorporated by reference herein.

TECHNICAL FIELD

The disclosed embodiments relate generally to memory systems, and in particular, to using heuristic aware garbage collection in storage systems.

BACKGROUND

Semiconductor memory devices, including flash memory, typically utilize memory cells to store data as an electrical value, such as an electrical charge or voltage. A flash memory cell, for example, includes a single transistor with a floating gate that is used to store a charge representative of a data value. Flash memory is a non-volatile data storage device that can be electrically erased and reprogrammed. Non-volatile memory retains stored information even when not powered, as opposed to volatile memory, which requires power to maintain the stored information. Increases in storage density have been facilitated in various ways, including increasing the density of memory cells on a chip enabled by manufacturing developments, and transitioning from single-level flash memory cells to multi-level flash memory cells, so that two or more bits can be stored by each flash memory cell.

Garbage collection is a process of memory management that reclaims portions of memory that no longer contain valid data. Using flash memory as an example, data is written to flash memory in units called pages, which are made up of multiple memory cells. However, flash memory is erased in larger units called blocks, which are made up of multiple pages. If some pages of a first block contain invalid data, those pages cannot be overwritten until the whole block containing those pages is erased. The process of garbage collection reads and re-writes the pages with valid data from the first block into a second block and then erases the first block. After garbage collection, the second block contains pages with valid data and free pages that are available for new data to be written. Since flash memory can only be programmed and erased a limited number of times, it is important to utilize a garbage collection scheme that maximizes or improves the life of a flash-based storage system.

SUMMARY

Various implementations of systems, methods and devices within the scope of the appended claims each have several aspects, no single one of which is solely responsible for the attributes described herein. Without limiting the scope of the appended claims, after considering this disclosure, and particularly after considering the section entitled “Detailed Description” one will understand how the aspects of various implementations are used to enable heuristic aware garbage collection in storage systems (e.g., non-volatile data storage systems using one or more flash memory devices). In one aspect, a time parameter (e.g., dwell time) and/or heuristics (e.g., error count, error rate, number of reads, number of times programmed, etc.) are used in a garbage collection scheme.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the present disclosure can be understood in greater detail, a more particular description may be had by reference to the features of various implementations, some of which are illustrated in the appended drawings. The appended drawings, however, merely illustrate the more pertinent features of the present disclosure and are therefore not to be considered limiting, for the description may admit to other effective features.

FIG. 1 is a block diagram illustrating an implementation of a data storage system, in accordance with some embodiments.

FIG. 2 is a block diagram illustrating an implementation of a management module, in accordance with some embodiments.

FIG. 3A is a prophetic diagram of voltage distributions that may be found in a single-level flash memory cell (SLC) over time, in accordance with some embodiments.

FIG. 3B is a prophetic diagram of voltage distributions that may be found in a multi-level flash memory cell (MLC) over time, in accordance with some embodiments.

FIGS. 4A-4C illustrate a flowchart representation of a method of garbage collection for a storage medium in a storage system, in accordance with some embodiments.

FIG. 5 illustrates a flowchart representation of a method of garbage collection for a storage medium in a storage system, in accordance with some embodiments.

In accordance with common practice the various features illustrated in the drawings may not be drawn to scale. Accordingly, the dimensions of the various features may be arbitrarily expanded or reduced for clarity. In addition, some of the drawings may not depict all of the components of a given system, method or device. Finally, like reference numerals may be used to denote like features throughout the specification and figures.

DETAILED DESCRIPTION

The various implementations described herein include systems, methods and/or devices used to enable heuristic aware garbage collection in storage systems (e.g., non-volatile data storage systems). Some implementations include systems, methods and/or devices to utilize a time parameter and/or heuristics in a garbage collection scheme.

More specifically, some implementations include a method of garbage collection for a storage medium in a storage system. In some implementations, the method includes (1) determining a time parameter for a block in the storage medium, and (2) in accordance with a determination that the time parameter for the block is greater than a first threshold time, enabling garbage collection of the block.

In some embodiments, the method includes, in accordance with a determination that the time parameter for the block is greater than the first threshold time and that the block meets predefined staleness criteria, enabling garbage collection of the block.

In some embodiments, the time parameter is a dwell time, the dwell time being a time since a last program command to modify data stored in the block.

In some embodiments, the method further includes adapting the first threshold time based on one or more parameter values of the block.

In some embodiments, determining the time parameter for the block includes determining a time when the block was last programmed.

In some embodiments, the method further includes (1) selecting a set of blocks from the storage medium, (2) determining a second threshold time for the set of blocks, and (3) for each block in the set of blocks, in accordance with a determination that the time parameter for the block is less than the determined second threshold time, disabling garbage collection of the block.

In some embodiments, the second threshold time is greater than the first threshold time

In some embodiments, the storage medium includes a plurality of sets of blocks, and the method further includes (1) suspending garbage collection of a first set of blocks for the determined second threshold time, and (2) suspending, in succession, garbage collection of all other sets of blocks of the plurality of sets of blocks for the determined second threshold time before suspending garbage collection of the first set of blocks again

In some embodiments, the aforementioned selecting of a set of blocks from the storage medium includes selecting the set of blocks in accordance with one or more parameter values, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block.

In some embodiments, the method further includes adapting the second threshold time based on one or more parameter values of the set of blocks, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block.

In some embodiments, the method further includes, for each block in the set of blocks, in accordance with a determination that the time parameter for the block is less than the determined second threshold time, disabling write access to the block in accordance with host write commands.

In another aspect, a method of garbage collection for a storage medium in a storage system includes identifying a set of garbage collection eligible blocks, including (1) determining a time parameter for each unerased block in a set of blocks in the storage medium, and (2) identifying, in accordance with the time parameter for each unerased block in the set of blocks, the set of garbage collection eligible blocks. The method further includes selecting a subset of the set of garbage collection eligible blocks for garbage collection in accordance with predefined staleness criteria.

In some embodiments, the set of blocks includes a first set of blocks and a second set of blocks distinct from the first set of blocks, and the identifying includes identifying garbage collection eligible blocks from among the first set of blocks in accordance with a first threshold time and identifying garbage collection eligible blocks from among the second set of blocks in accordance with a second threshold time that is greater than the first threshold time.

In some embodiments, the storage medium comprises one or more non-volatile storage devices, such as flash memory devices.

In another aspect, any of the methods described above are performed by a device operable to perform garbage collection for a storage medium, the device including (1) a storage medium interface for coupling the device to the storage medium, and (2) one or more modules, including a memory management module that includes one or more processors and memory storing one or more programs configured for execution by the one or more processors, the one or more modules coupled to the storage medium interface and configured to perform any of the methods described above.

In yet another aspect, a device is operable to perform garbage collection for a storage medium. In some embodiments, the device includes (1) a storage medium interface for coupling the device to the storage medium, (2) means for determining a time parameter for a block in the storage medium, and (3) means for enabling, in accordance with a determination that the time parameter for the block is greater than a first threshold time, garbage collection of the block.

In yet another aspect, any of the methods described above are performed by a storage system comprising (1) a storage medium (e.g., comprising one or more non-volatile storage devices, such as flash memory devices) (2) one or more processors, and (3) memory storing one or more programs, which when executed by the one or more processors cause the storage system to perform or control performance of any of the methods described above.

In yet another aspect, a non-transitory computer readable storage medium stores one or more programs configured for execution by a device coupled to a storage medium, the one or more programs comprising instructions for causing the device and/or storage medium to perform any of the methods described above.

Numerous details are described herein in order to provide a thorough understanding of the example implementations illustrated in the accompanying drawings. However, some embodiments may be practiced without many of the specific details, and the scope of the claims is only limited by those features and aspects specifically recited in the claims. Furthermore, well-known methods, components, and circuits have not been described in exhaustive detail so as not to unnecessarily obscure more pertinent aspects of the implementations described herein.

FIG. 1 is a diagram of an implementation of a data storage system 100, in accordance with some embodiments. While some example features are illustrated, various other features have not been illustrated for the sake of brevity and so as not to obscure more pertinent aspects of the example implementations disclosed herein. To that end, as a non-limiting example, the data storage system 100 includes a memory controller 120, and a storage medium 130, and is used in conjunction with a computer system 110. In some implementations, storage medium 130 is a single flash memory device while in other implementations storage medium 130 includes a plurality of flash memory devices. In some implementations, storage medium 130 is NAND-type flash memory or NOR-type flash memory. Further, in some implementations memory controller 120 is a solid-state drive (SSD) controller. However, other types of storage media may be included in accordance with aspects of a wide variety of implementations.

Computer system 110 is coupled to memory controller 120 through data connections 101. However, in some implementations computer system 110 includes memory controller 120 as a component and/or a sub-system. Computer system 110 may be any suitable computer device, such as a computer, a laptop computer, a tablet device, a netbook, an internet kiosk, a personal digital assistant, a mobile phone, a smart phone, a gaming device, a computer server, or any other computing device. Computer system 110 is sometimes called a host or host system. In some implementations, computer system 110 includes one or more processors, one or more types of memory, a display and/or other user interface components such as a keyboard, a touch screen display, a mouse, a track-pad, a digital camera and/or any number of supplemental devices to add functionality.

Storage medium 130 is coupled to memory controller 120 through connections 103. Connections 103 are sometimes called data connections, but typically convey commands in addition to data, and optionally convey metadata, error correction information and/or other information in addition to data values to be stored in storage medium 130 and data values read from storage medium 130. In some implementations, however, memory controller 120 and storage medium 130 are included in the same device as components thereof. Furthermore, in some implementations memory controller 120 and storage medium 130 are embedded in a host device, such as a mobile device, tablet, other computer or computer controlled device, and the methods described herein are performed by the embedded memory controller. Storage medium 130 may include any number (i.e., one or more) of memory devices including, without limitation, non-volatile semiconductor memory devices, such as flash memory. For example, flash memory devices can be configured for enterprise storage suitable for applications such as cloud computing, or for caching data stored (or to be stored) in secondary storage, such as hard disk drives. Additionally and/or alternatively, flash memory can also be configured for relatively smaller-scale applications such as personal flash drives or hard-disk replacements for personal, laptop and tablet computers.

Storage medium 130 is divided into a number of addressable and individually selectable blocks, such as selectable portion 131. In some implementations, the individually selectable blocks are the minimum size erasable units in a flash memory device. In other words, each block contains the minimum number of memory cells that can be erased simultaneously. Each block is usually further divided into a plurality of pages and/or word lines, where each page or word line is typically an instance of the smallest individually accessible (readable) portion in a block. In some implementations (e.g., using some types of flash memory), the smallest individually accessible unit of a data set, however, is a sector, which is a subunit of a page. That is, a block includes a plurality of pages, each page contains a plurality of sectors, and each sector is the minimum unit of data for reading data from the flash memory device.

For example, one block comprises any number of pages, for example, 64 pages, 128 pages, 256 pages or another suitable number of pages. Blocks are typically grouped into a plurality of zones. Each block zone can be independently managed to some extent, which increases the degree of parallelism for parallel operations and simplifies management of storage medium 130.

In some implementations, memory controller 120 includes a management module 121, a host interface 129, a storage medium interface (I/O) 128, and additional module(s) 125. Memory controller 120 may include various additional features that have not been illustrated for the sake of brevity and so as not to obscure more pertinent features of the example implementations disclosed herein, and a different arrangement of features may be possible. Host interface 129 provides an interface to computer system 110 through data connections 101. Similarly, storage medium I/O 128 provides an interface to storage medium 130 though connections 103. In some implementations, storage medium I/O 128 includes read and write circuitry, including circuitry capable of providing reading signals to storage medium 130 (e.g., reading threshold voltages for NAND-type flash memory).

In some implementations, management module 121 includes one or more processing units (CPUs, also sometimes called processors) 122 configured to execute instructions in one or more programs (e.g., in management module 121). In some implementations, the one or more CPUs 122 are shared by one or more components within, and in some cases, beyond the function of memory controller 120. Management module 121 is coupled to host interface 129, additional module(s) 125 and storage medium I/O 128 in order to coordinate the operation of these components.

Additional module(s) 125 are coupled to storage medium I/O 128, host interface 129, and management module 121. As an example, additional module(s) 125 may include an error control module to limit the number of uncorrectable errors inadvertently introduced into data during writes to memory or reads from memory. In some embodiments, additional module(s) 125 are executed in software by the one or more CPUs 122 of management module 121, and, in other embodiments, additional module(s) 125 are implemented in whole or in part using special purpose circuitry (e.g., to perform encoding and decoding functions).

During a write operation, host interface 129 receives data to be stored in storage medium 130 from computer system 110. The data held in host interface 129 is made available to an encoder (e.g., in additional module(s) 125), which encodes the data to produce one or more codewords. The one or more codewords are made available to storage medium I/O 128, which transfers the one or more codewords to storage medium 130 in a manner dependent on the type of storage medium being utilized.

A read operation is initiated when computer system (host) 110 sends one or more host read commands on control line 111 to memory controller 120 requesting data from storage medium 130. Memory controller 120 sends one or more read access commands to storage medium 130, via storage medium I/O 128, to obtain raw read data in accordance with memory locations (addresses) specified by the one or more host read commands. Storage medium I/O 128 provides the raw read data (e.g., comprising one or more codewords) to a decoder (e.g., in additional module(s) 125). If the decoding is successful, the decoded data is provided to host interface 129, where the decoded data is made available to computer system 110. In some implementations, if the decoding is not successful, memory controller 120 may resort to a number of remedial actions or provide an indication of an irresolvable error condition.

Flash memory devices utilize memory cells to store data as electrical values, such as electrical charges or voltages. Each flash memory cell typically includes a single transistor with a floating gate that is used to store a charge, which modifies the threshold voltage of the transistor (i.e., the voltage needed to turn the transistor on). The magnitude of the charge, and the corresponding threshold voltage the charge creates, is used to represent one or more data values. In some implementations, during a read operation, a reading threshold voltage is applied to the control gate of the transistor and the resulting sensed current or voltage is mapped to a data value.

The terms “cell voltage” and “memory cell voltage,” in the context of flash memory cells, means the threshold voltage of the memory cell, which is the minimum voltage that needs to be applied to the gate of the memory cell's transistor in order for the transistor to conduct current. Similarly, reading threshold voltages (sometimes also called reading signals and reading voltages) applied to a flash memory cells are gate voltages applied to the gates of the flash memory cells to determine whether the memory cells conduct current at that gate voltage. In some implementations, when a flash memory cell's transistor conducts current at a given reading threshold voltage, indicating that the cell voltage is less than the reading threshold voltage, the raw data value for that read operation is a “1,” and otherwise the raw data value is a “0.”

As explained above, a storage medium (e.g., storage medium 130) is divided into a number of addressable and individually selectable blocks and each block is optionally (but typically) further divided into a plurality of pages and/or word lines and/or sectors. While erasure of a storage medium is performed on a block basis, in many embodiments, reading and programming of the storage medium is performed on a smaller subunit of a block (e.g., on a page basis, word line basis, or sector basis). In some embodiments, the smaller subunit of a block consists of multiple memory cells (e.g., single-level cells or multi-level cells, as described below). In some embodiments, programming is performed on an entire page.

As an example, if data is written to a storage medium in pages, but the storage medium is erased in blocks, pages in the storage medium may contain invalid (e.g., stale) data, but those pages cannot be overwritten until the whole block containing those pages is erased. In order to write to the pages with invalid data, the pages with valid data in that block are read and re-written to a new block and the old block is erased (or put on a queue for erasing). This process is called garbage collection. After garbage collection, the new block contains pages with valid data and free pages that are available for new data to be written, and the old block that was erased is also available for new data to be written. Since flash memory can only be programmed and erased a limited number of times, the efficiency of the algorithm used to pick the next block(s) to re-write and erase has a significant impact on the lifetime and reliability of flash-based storage systems.

FIG. 2 is a block diagram illustrating an exemplary management module 121, in accordance with some embodiments. Management module 121 typically includes one or more processing units (CPUs) 122 for executing modules, programs and/or instructions stored in memory 206 and thereby performing processing operations, memory 206, and one or more communication buses 208 for interconnecting these components. Communication buses 208 optionally include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Management module 121 is coupled to host interface 129, additional module(s) 125, and storage medium I/O 128 by communication buses 208. Memory 206 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices, and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 206 optionally includes one or more storage devices remotely located from the CPU(s) 122. Memory 206, or alternately the non-volatile memory device(s) within memory 206, comprises a non-transitory computer readable storage medium. In some embodiments, memory 206, or the computer readable storage medium of memory 206 stores the following programs, modules, and data structures, or a subset thereof:

-   -   a time parameter module 216 that is used for determining a time         parameter (e.g., dwell time) for a block (e.g., selectable         portion of storage medium 131, FIG. 1) in a storage medium         (e.g., storage medium 130, FIG. 1);     -   a threshold time module 218 that is used to determine and/or         adapt one or more threshold times for one or more blocks in a         storage medium;     -   a garbage collection module 220 that is used for garbage         collection for one or more blocks in a storage medium;

In some embodiments, the garbage collection module 220 optionally includes the following modules or sub-modules, or a subset thereof:

-   -   an identification module 222 that is used for identifying a set         of garbage collection eligible blocks;     -   a selection module 224 that is used for selecting a set of         blocks from a storage medium for vacation and/or for selecting a         subset of the set of garbage collection eligible blocks in         accordance with one or more parameters (e.g., staleness         criteria);     -   an enable module 226 that is used for enabling garbage         collection of one or more blocks;     -   a disable module 228 that is used for disabling garbage         collection of one or more blocks and/or disabling write access         to one or more blocks;     -   a vacation module 230 that is used for suspending garbage         collection of one or more blocks for a determined time;     -   a data read module 232 that is used for reading data from one or         more blocks in a storage medium;     -   a data write module 234 that is used for writing data to one or         more blocks in a storage medium; and     -   a data erase module 236 that is used for erasing data from one         or more blocks in a storage medium.

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices, and corresponds to a set of instructions for performing a function described above. The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise re-arranged in various embodiments. In some embodiments, memory 206 may store a subset of the modules and data structures identified above. Furthermore, memory 206 may store additional modules and data structures not described above. In some embodiments, the programs, modules, and data structures stored in memory 206, or the computer readable storage medium of memory 206, provide instructions for implementing any of the methods described below with reference to FIGS. 4A-4C and 5.

Although FIG. 2 shows a management module 121, FIG. 2 is intended more as functional description of the various features which may be present in a management module than as a structural schematic of the embodiments described herein. In practice, and as recognized by those of ordinary skill in the art, items shown separately could be combined and some items could be separated.

As discussed below with reference to FIG. 3A, a single-level flash memory cell (SLC) stores one bit (“0” or “1”). Thus, the storage density of a SLC memory device is one bit of information per memory cell. A multi-level flash memory cell (MLC), however, can store two or more bits of information per cell by using different ranges within the total voltage range of the memory cell to represent a multi-bit bit-tuple. In turn, the storage density of a MLC memory device is multiple-bits per cell (e.g., two bits per memory cell).

FIG. 3A is a simplified, prophetic diagram of voltage distributions 300 a found in a single-level flash memory cell (SLC) over time, in accordance with some embodiments. The voltage distributions 300 a shown in FIG. 3A have been simplified for illustrative purposes. In this example, the SLC's voltage range extends approximately from a voltage, V_(SS), at a source terminal of an NMOS transistor to a voltage, V_(DD), at a drain terminal of the NMOS transistor. As such, voltage distributions 300 a extend between V_(SS) and V_(DD).

Sequential voltage ranges 301 and 302 between source voltage V_(SS) and drain voltage V_(DD) are used to represent corresponding bit values “1” and “0,” respectively. Each voltage range 301, 302 has a respective center voltage V₁ 301 b, V₀ 302 b. As described below, in many circumstances the memory cell current sensed in response to an applied reading threshold voltages is indicative of a memory cell voltage different from the respective center voltage V₁ 301 b or V₀ 302 b corresponding to the respective bit value written into the memory cell. Errors in cell voltage, and/or the cell voltage sensed when reading the memory cell, can occur during write operations, read operations, or due to “drift” of the cell voltage between the time data is written to the memory cell and the time a read operation is performed to read the data stored in the memory cell. For ease of discussion, these effects are collectively described as “cell voltage drift.” Each voltage range 301, 302 also has a respective voltage distribution 301 a, 302 a that may occur as a result of any number of a combination of error-inducing factors, examples of which are identified above.

In some implementations, a reading threshold voltage V_(R) is applied between adjacent center voltages (e.g., applied proximate to the halfway region between adjacent center voltages V₁ 301 b and V₀ 302 b). Optionally, in some implementations, the reading threshold voltage is located between voltage ranges 301 and 302. In some implementations, reading threshold voltage V_(R) is applied in the region proximate to where the voltage distributions 301 a and 302 a overlap, which is not necessarily proximate to the halfway region between adjacent center voltages V₁ 301 b and V₀ 302 b.

In order to increase storage density in flash memory, flash memory has developed from single-level (SLC) cell flash memory to multi-level cell (MLC) flash memory so that two or more bits can be stored by each memory cell. As discussed below with reference to FIG. 3B, a MLC flash memory device is used to store multiple bits by using voltage ranges within the total voltage range of the memory cell to represent different bit-tuples. A MLC flash memory device is typically more error-prone than a SLC flash memory device created using the same manufacturing process because the effective voltage difference between the voltages used to store different data values is smaller for a MLC flash memory device. Moreover, due to any number of a combination of factors, such as electrical fluctuations, defects in the storage medium, operating conditions, device history, and/or write-read circuitry, a typical error includes a stored voltage level in a particular MLC being in a voltage range that is adjacent to the voltage range that would otherwise be representative of the correct storage of a particular bit-tuple. As discussed in greater detail below with reference to FIG. 3B, the impact of such errors can be reduced by gray-coding the data, such that adjacent voltage ranges represent single-bit changes between bit-tuples.

FIG. 3B is a simplified, prophetic diagram of voltage distributions 300 b found in a multi-level flash memory cell (MLC) over time, in accordance with some embodiments. The voltage distributions 300 b shown in FIG. 3B have been simplified for illustrative purposes. The cell voltage of a MLC approximately extends from a voltage, V_(SS), at the source terminal of a NMOS transistor to a voltage, V_(DD), at the drain terminal. As such, voltage distributions 300 b extend between V_(SS) and V_(DD).

Sequential voltage ranges 311, 312, 313, 314 between the source voltage V_(SS) and drain voltages V_(DD) are used to represent corresponding bit-tuples “11,” “01,” “00,” “10,” respectively. Each voltage range 311, 312, 313, 314 has a respective center voltage 311 b, 312 b, 313 b, 314 b. Each voltage range 311, 312, 313, 314 also has a respective voltage distribution 311 a, 312 a, 313 a, 314 a that may occur as a result of any number of a combination of factors, such as electrical fluctuations, defects in the storage medium, operating conditions, device history (e.g., number of program-erase (PE) cycles), and/or imperfect performance or design of write-read circuitry.

Ideally, during a write operation, the charge on the floating gate of the MLC would be set such that the resultant cell voltage is at the center of one of the ranges 311, 312, 313, 314 in order to write the corresponding bit-tuple to the MLC. Specifically, the resultant cell voltage would be set to one of V₁₁ 311 b, V₀₁ 312 b, V₀₀ 313 b and V₁₀ 314 b in order to write a corresponding one of the bit-tuples “11,” “01,” “00” and “10.” In reality, due to the factors mentioned above, the initial cell voltage may differ from the center voltage for the data written to the MLC.

Reading threshold voltages V_(RA), V_(RB) and V_(RC) are positioned between adjacent center voltages (e.g., positioned at or near the halfway point between adjacent center voltages) and, thus, define threshold voltages between the voltage ranges 311, 312, 313, 314. During a read operation, one of the reading threshold voltages V_(RA), V_(RB) and V_(RC) is applied to determine the cell voltage using a comparison process. However, due to the various factors discussed above, the actual cell voltage, and/or the cell voltage received when reading the MLC, may be different from the respective center voltage V₁₁ 311 b, V₀₁ 312 b, V₀₀ 313 b or V₁₀ 314 b corresponding to the data value written into the cell. For example, the actual cell voltage may be in an altogether different voltage range, strongly indicating that the MLC is storing a different bit-tuple than was written to the MLC. More commonly, the actual cell voltage may be close to one of the read comparison voltages, making it difficult to determine with certainty which of two adjacent bit-tuples is stored by the MLC.

Errors in cell voltage, and/or the cell voltage received when reading the MLC, can occur during write operations, read operations, or due to “drift” of the cell voltage between the time data is written to the MLC and the time a read operation is performed to read the data stored in the MLC. For ease of discussion, sometimes errors in cell voltage, and/or the cell voltage received when reading the MLC, are collectively called “cell voltage drift.”

One way to reduce the impact of a cell voltage drifting from one voltage range to an adjacent voltage range is to gray-code the bit-tuples. Gray-coding the bit-tuples includes constraining the assignment of bit-tuples such that a respective bit-tuple of a particular voltage range is different from a respective bit-tuple of an adjacent voltage range by only one bit. For example, as shown in FIG. 3B, the corresponding bit-tuples for adjacent ranges 301 and 302 are respectively “11” and “01,” the corresponding bit-tuples for adjacent ranges 302 and 303 are respectively “01” and “00,” and the corresponding bit-tuples for adjacent ranges 303 and 304 are respectively “00” and “10.” Using gray-coding, if the cell voltage drifts close to a read comparison voltage level, the error is typically limited to a single bit within the 2-bit bit-tuple.

FIGS. 4A-4C illustrate a flowchart representation of a method 400 of garbage collection for a storage medium in a storage system, in accordance with some embodiments. As noted above with respect to FIG. 1, since erasure of a storage medium is performed on a block basis, but in many embodiments, programming of the storage medium is performed on a smaller subunit of a block (e.g., on a page basis), pages with invalid data cannot be overwritten until the whole block containing those pages is erased. The storage system (e.g., data storage system 100, FIG. 1) uses garbage collection to reclaim portions of memory (e.g., storage medium 130, FIG. 1) that no longer contain valid data, which initiates performance of method 400.

At least in some implementations, method 400 is performed by a storage system (e.g., data storage system 100, FIG. 1) or one or more components of the storage system (e.g., memory controller 120 and/or storage medium 130, FIG. 1). In some embodiments, method 400 is governed by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a device, such as the one or more processing units (CPUs) 122 of management module 121, shown in FIGS. 1 and 2.

A storage system (e.g., data storage system 100, FIG. 1) determines (402) a time parameter for a block (e.g., selectable portion of storage medium 131, FIG. 1) in a storage medium (e.g., storage medium 130, FIG. 1) in the storage system. In some implementations, a time parameter module (e.g., time parameter module 216, FIG. 2) is used to determine a time parameter for a block, as described above with respect to FIG. 2.

In some embodiments, the time parameter is (404) a dwell time, the dwell time being a time since a last program command to modify data stored in the block. In some implementations, the actual dwell time is the time between the last program command to modify data stored in the block and the next erase command to erase the block. In an active garbage collection scheme, in some embodiments, blocks remain programmed until they need to be erased to accommodate new host write commands. Soon after a block is erased by the garbage collection process, it is programmed by a host write command. Thus, the greater the dwell time for a block, the greater the time between program commands to modify data stored in the block. Dwell time has a significant impact on the error rate characteristics of a storage system (e.g., data storage system 100, FIG. 1). For example, if a system is operated in a lower dwell time region (e.g., less than 50 seconds), the error rate can be orders of magnitude higher than when the system is operated in a higher dwell time region (e.g., greater than 200 seconds). In addition, the effect of dwell time is more pronounced if the storage system is operating under high temperature.

In some embodiments, determining (406) the time parameter for the block includes determining a time when the block was last programmed. In some implementations, determining a time when the block was last programmed includes tagging the block with a time when the block was last programmed. In some implementations, each block in the system is time tagged with the time it was last programmed.

In some embodiments, the storage medium comprises (408) one or more non-volatile storage devices, such as flash memory devices. In some implementations, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) is a single flash memory device, while in other implementations, the non-volatile storage medium includes a plurality of flash memory devices. In some implementations, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) is NAND-type flash memory or NOR-type flash memory.

Next, in accordance with a determination that the time parameter for the block is greater than a first threshold time, the storage system enables (410) garbage collection of the block. In some embodiments, the first threshold time is a minimum dwell time. For example, if the first threshold time (e.g., minimum dwell time) is 200 seconds, the storage system only enables garbage collection of the block when the time parameter for the block (e.g., actual dwell time) is greater than 200 seconds. In some implementations, an enable module (e.g., enable module 226, FIG. 2) is used for enabling garbage collection of the block, as described above with respect to FIG. 2.

In some embodiments, in accordance with a determination that the time parameter for the block is greater than the first threshold time and that the block meets predefined staleness criteria, the storage system enables (412) garbage collection of the block. In some implementations, predefined staleness criteria include criteria regarding the level of staleness of the data in a block (e.g., time since last read or write in the block). For example, if the staleness criteria is defined as the highest staleness and the first threshold time (e.g., minimum dwell time) is 200 seconds, the storage system only enables garbage collection of the block when the time parameter for the block (e.g., actual dwell time) is greater than 200 seconds and the block has the highest level of staleness.

In some embodiments, the first threshold time is (414) determined in accordance with one or more characteristics of the block. In some implementations, the first threshold time (e.g., minimum dwell time) is determined by device characterization and may vary depending on one or more device characteristics (e.g., process technology, operating temperature, programming algorithm, etc.). In some implementations, a threshold time module (e.g., threshold time module 218, FIG. 2) is used to determine and/or adapt the first threshold time, as described above with respect to FIG. 2.

Optionally, the storage system adapts (416) the first threshold time based on one or more parameter values of the block. In some embodiments, the one or more parameter values of the block include the number of times the block has been programmed, memory cell wear-out, frequency of read scrub, dynamic read frequency, and/or usage frequency of secondary error recovery or other techniques for recovering from the block data that would otherwise have been lost. Alternatively, or in addition, in some embodiments, the one or more parameter values of the block include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block, as discussed below with respect to operation 420. In some implementations, a threshold time module (e.g., threshold time module 218, FIG. 2) is used to determine and/or adapt the first threshold time, as described above with respect to FIG. 2.

Optionally, the storage system selects (418) a set of blocks from the storage medium. In some embodiments, the set of blocks are selected for “vacation” (e.g., a longer dwell time). Blocks on vacation are provided healing time for the de-trapping of charges in the oxide of the memory cells. This healing time helps to reduce the error rate and extends the overall life of the storage system. The number of blocks selected for vacation is selected such that it has negligible impact on usable over-provisioning. In some implementations, for example, the number of blocks on vacation ranges from 0.1% to 2% of the total number of blocks in the storage medium. In some implementations, a selection module (e.g., selection module 224, FIG. 2) is used to select the set of blocks from the storage medium, as described above with respect to FIG. 2.

As discussed below with reference to operations 428, 430, and 432, for purposes of selecting a current set of blocks for vacation, in some embodiments the storage system rotates through multiple sets of blocks in round robin fashion, putting one set of blocks on vacation at a time.

In some other embodiments, the storage system selects (420) the set of blocks (i.e., selects individual respective blocks to include in the set of blocks for vacation) in accordance with one or more parameter values, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block. In some implementations, some blocks receive preferential vacation based on one or more parameter values. This helps to improve endurance for the blocks and to extend the life of the storage system. For example, in some implementations, blocks with a high error count are selected for vacation over blocks with a low error count. As another example, in some implementations, blocks with a high number of reads (e.g., blocks with “hot pages”) are selected for vacation over blocks with a low number of reads.

Next, the storage system determines (422) a second threshold time for the set of blocks. In some embodiments, the second threshold time is a vacation time, as described above. In some implementations, a threshold time module (e.g., threshold time module 218, FIG. 2) is used to determine and/or adapt the second threshold time, as described above with respect to FIG. 2.

In some embodiments, the second threshold time is greater than the first threshold time. For example, in some implementations, the first threshold time (e.g., minimum dwell time) is on the order of 200 seconds and the second threshold time (e.g., vacation time) is on the order of 20,000 seconds. In some implementations, the second threshold is long enough to provide healing time for the memory cells, which may be more or less than 20,000 seconds.

Next, for each block in the set of blocks, in accordance with a determination that the time parameter for the block is less than the determined second threshold time, the storage system disables (426) garbage collection of the block. As discussed above, in some embodiments, the second threshold time is a vacation time. For example, for a given block in the set of blocks, if the second threshold time (e.g., vacation time) is 20,000 seconds, the storage system disables garbage collection of the block when the time parameter for the block (e.g., actual dwell time) is less than 20,000 seconds. In some implementations, when a set of blocks is selected for vacation, garbage collection is disabled for the set of blocks during the vacation time. In some implementations, a disable module (e.g., disable module 228, FIG. 2) is used for disabling garbage collection of the block, as described above with respect to FIG. 2.

Optionally, in some embodiments, the storage medium includes (428) a plurality of sets of blocks. In some embodiments, the storage system suspends (430) garbage collection of a first set of blocks for the determined second threshold time. For example, if the storage medium includes four sets of blocks (e.g., set A, set B, set C, and set D) and the determined second threshold time (e.g., vacation time) is 20,000 seconds, the storage system suspends garbage collection of set A for 20,000 seconds. In some implementations, a vacation module (e.g., vacation module 230, FIG. 2) is used to suspend garbage collection of one or more blocks for the determined time, as described above with respect to FIG. 2.

Next, the storage system suspends (432), in succession, garbage collection of all other sets of blocks of the plurality of sets of blocks for the determined second threshold time before suspending garbage collection of the first set of blocks again. Using the example above where the storage medium includes four sets of blocks (e.g., set A, set B, set C, and set D), after the storage system suspends garbage collection of set A, the storage system suspends, in succession, garbage collection of set B, set C, and set D before suspending garbage collection of set A again. For example, if the determined second threshold time (e.g., vacation time) is 20,000 seconds, after the storage system suspends garbage collection of set A for 20,000 seconds, the storage system then suspends garbage collection of set B for 20,000 seconds, then suspends garbage collection of set C for 20,000 seconds, and then suspends garbage collection of set D for 20,000 seconds, before suspending garbage collection of set A again. In some implementations, a vacation module (e.g., vacation module 230, FIG. 2) is used to suspend garbage collection of one or more blocks for the determined time, as described above with respect to FIG. 2.

Optionally, in some embodiments, the storage medium adapts (434) the second threshold time based on one or more parameter values of the set of blocks, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for the set of blocks, an error rate for the set of blocks, number of reads from the set of blocks, number of times the set of blocks has been programmed, number of times the set of blocks has been erased, a read scrub frequency for the set of blocks, a dynamic read frequency for the set of blocks, and a reading threshold voltage margin for the set of blocks. Optionally, a respective parameter of the one or more parameters includes an average of the respective parameter value, per block, across the set of blocks. Optionally, a respective parameter of the one or more parameters includes a worst case value of the respective parameter value across the set of blocks.

In some implementations, the second threshold time (e.g., vacation time) is adapted based on the one or more parameter values used to select a set of blocks for preferential vacation, as discussed above with respect to operation 420. For example, in some implementations, a set of blocks with a high error count receives a longer vacation than a set of blocks with a low error count. In some implementations, a threshold time module (e.g., threshold time module 218, FIG. 2) is used to determine and/or adapt the second threshold time, as described above with respect to FIG. 2.

Optionally, in some embodiments, for each block in the set of blocks, in accordance with a determination that the time parameter for the block is less than the determined second threshold time, the storage medium disables (436) write access to the block in accordance with host write commands. As discussed above, in some embodiments, the second threshold time is a vacation time. For example, for a given block in the set of blocks, if the second threshold time (e.g., vacation time) is 20,000 seconds, the storage system disables write access to the block in accordance with host write commands when the time parameter for the block (e.g., actual dwell time) is less than 20,000 seconds. In some implementations, when a set of blocks is selected for vacation, write access to the blocks (e.g., from host write commands) is disabled for the set of blocks during the vacation time. In some implementations, a disable module (e.g., disable module 228, FIG. 2) is used for disabling write access to the block, as described above with respect to FIG. 2.

FIG. 5 illustrates a flowchart representation of a method 500 of garbage collection for a storage medium in a storage system, in accordance with some embodiments. As noted above with respect to FIG. 1, since erasure of a storage medium is performed on a block basis, but in many embodiments programming of the storage medium is performed on a smaller subunit of a block (e.g., on a page basis), pages with invalid data cannot be overwritten until the whole block containing those pages is erased. The storage system (e.g., data storage system 100, FIG. 1) uses garbage collection to reclaim portions of memory (e.g., storage medium 130, FIG. 1) that no longer contain valid data, which initiates performance of method 500.

At least in some implementations, method 500 is performed by a storage system (e.g., data storage system 100, FIG. 1) or one or more components of the storage system (e.g., memory controller 120 and/or storage medium 130, FIG. 1). In some embodiments, method 500 is governed by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a device, such as the one or more processing units (CPUs) 122 of management module 121, shown in FIGS. 1 and 2.

A storage system (e.g., data storage system 100, FIG. 1) identifies (502) a set of garbage collection eligible blocks, including determining (504) a time parameter for each unerased block in a set of blocks in a storage medium (e.g., storage medium 130, FIG. 1) in the storage system. In some implementations, a time parameter module (e.g., time parameter module 216, FIG. 2) is used to determine a time parameter for a block, as described above with respect to FIG. 2.

In some embodiments, the time parameter is a dwell time, the dwell time being a time since a last program command to modify data stored in the block, as discussed above with respect to operation 404.

In some embodiments, determining the time parameter for the block includes determining a time when the block was last programmed, as discussed above with respect to operation 406.

In some embodiments, the storage medium comprises (506) one or more non-volatile storage devices, such as flash memory devices. In some implementations, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) is a single flash memory device, while in other implementations, the non-volatile storage medium includes a plurality of flash memory devices. In some implementations, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) is NAND-type flash memory or NOR-type flash memory.

Next, the storage system further identifies (502) a set of garbage collection eligible blocks by identifying (508), in accordance with the time parameter for each unerased block in the set of blocks, the set of garbage collection eligible blocks. In some embodiments, the storage system identifies the set of garbage collection eligible blocks based on the time parameter for each unerased block in the set of blocks. As discussed above, in some embodiments, the time parameter is a dwell time and the storage system identifies the set of garbage collection eligible blocks based on the dwell time for each unerased block in the set of blocks. In some implementations, an identification module (e.g., identification module 222, FIG. 2) is used to identify a set of garbage collection eligible blocks, as described above with respect to FIG. 2.

In some embodiments, the set of blocks includes (510) a first set of blocks and a second set of blocks distinct from the first set of blocks, and the identifying includes identifying garbage collection eligible blocks from among the first set of blocks in accordance with a first threshold time and identifying garbage collection eligible blocks from among the second set of blocks in accordance with a second threshold time that is greater than the first threshold time. In some embodiments, the first threshold time is a minimum dwell time and the second threshold time is a vacation time, as described above. For example, if the first threshold time (e.g., minimum dwell time) is 200 seconds and the second threshold time (e.g., vacation time) is 20,000 seconds, the storage system identifies garbage collection eligible blocks from among the first set of blocks in accordance with the first threshold time (e.g., 200 seconds) and identifies garbage collection eligible blocks from among the second set of blocks in accordance with the second threshold time (e.g., 20,000 seconds). In some implementations, blocks from the first set of blocks are eligible for garbage collection when their time parameter (e.g., dwell time) is greater than the first threshold time (e.g., minimum dwell time) and blocks from the second set of blocks are eligible for garbage collection when their time parameter (e.g., dwell time) is greater than the second threshold time (e.g., vacation time). In some implementations, the blocks in the second set of blocks are on vacation, as described above with respect to operation 418.

Next, the storage system selects (512) a subset of the set of garbage collection eligible blocks for garbage collection in accordance with predefined staleness criteria. In some embodiments, the storage system identifies a staleness parameter (e.g., time since last read or write) for each unerased block in the set of blocks, and then selects the N blocks having the largest staleness parameters, where N is the target number of blocks to be garbage collected. For example, if N is equal to four, from the set of garbage collection eligible blocks identified in operation 502, the storage system selects the four blocks having the largest staleness parameters for garbage collection. In some implementations, a selection module (e.g., selection module 224, FIG. 2) is used to select the subset of the set of garbage collection eligible blocks for garbage collection in accordance with predefined staleness criteria, as described above with respect to FIG. 2.

In some implementations, with respect to any of the methods described above, the storage medium (e.g., storage medium 130, FIG. 1) is a single flash memory device, while in other implementations, the storage medium (e.g., storage medium 130, FIG. 1) includes a plurality of flash memory devices.

In some implementations, with respect to any of the methods described above, a storage system includes a storage medium (e.g., storage medium 130, FIG. 1), one or more processors (e.g., CPUs 122, FIGS. 1 and 2) and memory (e.g., memory 206, FIG. 2) storing one or more programs configured for execution by the one or more processors and configured to perform or control performance of any of the methods described above.

In some implementations, with respect to any of the methods described above, a device operable to perform garbage collection includes a storage medium interface (e.g., storage medium I/O 128, FIG. 1) for coupling the device to the storage medium (e.g., storage medium 130, FIG. 1) and one or more modules, including a memory management module (e.g., management module 121, FIGS. 1 and 2) that includes one or more processors (e.g., CPUs 122, FIGS. 1 and 2) and memory (e.g., memory 206, FIG. 2) storing one or more programs configured for execution by the one or more processors, the one or more modules coupled to the storage medium interface (e.g., storage medium I/O 128, FIG. 1) and configured to perform or control performance of any of the methods described above.

It will be understood that, although the terms “first,” “second,” etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first contact could be termed a second contact, and, similarly, a second contact could be termed a first contact, which changing the meaning of the description, so long as all occurrences of the “first contact” are renamed consistently and all occurrences of the second contact are renamed consistently. The first contact and the second contact are both contacts, but they are not the same contact.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the claims. As used in the description of the embodiments and the appended claims, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.

The foregoing description, for purpose of explanation, has been described with reference to specific implementations. However, the illustrative discussions above are not intended to be exhaustive or to limit the claims to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The implementations were chosen and described in order to best explain principles of operation and practical applications, to thereby enable others skilled in the art. 

What is claimed is:
 1. A method of garbage collection for a storage medium in a storage system, the method comprising: determining a time parameter for a block in the storage medium; adapting a first threshold time based on one or more parameter values of the block; in accordance with a determination that the time parameter for the block is greater than the first threshold time, as adapted, enabling garbage collection of the block; selecting a first set of multiple blocks from the storage medium; determining a second threshold time for the first set of multiple blocks, wherein the second threshold time is distinct from the first threshold time; and for each block in the first set of multiple blocks, in accordance with a determination that the time parameter for the block is less than the second threshold time, suspending garbage collection of the block for a remaining duration of the second threshold time.
 2. The method of claim 1, including: in accordance with a determination that the time parameter for the block is greater than the first threshold time and that the block meets predefined staleness criteria, enabling garbage collection of the block.
 3. The method of claim 1, wherein the time parameter is a dwell time, the dwell time being a time since a last program command to modify data stored in the block.
 4. The method of claim 1, wherein the first threshold time is determined in accordance with one or more characteristics of the block.
 5. The method of claim 1, wherein determining the time parameter for the block includes determining a time when the block was last programmed.
 6. A method of garbage collection for a storage medium in a storage system, comprising: selecting a first set of multiple blocks from the storage medium, wherein the storage system uses one or more parameter values to select blocks to include in the first set of multiple blocks; determining a threshold time for the first set of multiple blocks; for each block in the first set of multiple blocks, in accordance with a determination that a time parameter for the block is less than the determined threshold time, suspending garbage collection of the block for a remaining duration of the determined threshold time; and suspending, in succession, garbage collection of each set of blocks, in two or more other sets of blocks in the storage medium, for a respective threshold time, before suspending garbage collection of the first set of blocks again.
 7. The method of claim 6, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block.
 8. The method of claim 6, further comprising adapting the threshold time based on the one or more parameter values of the set of blocks, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for the set of blocks, an error rate for the set of blocks, number of reads from the set of blocks, number of times the set of blocks has been programmed, number of times the set of blocks has been erased, a read scrub frequency for the set of blocks, a dynamic read frequency for the set of blocks, and a reading threshold voltage margin for the set of blocks.
 9. The method of claim 1, wherein the storage medium comprises one or more flash memory devices.
 10. A method of garbage collection for a storage medium in a storage system, the method comprising: determining a time parameter for each unerased block in a set of blocks in the storage medium, wherein the set of blocks includes a first set of multiple blocks and a second set of multiple blocks distinct from the first set of multiple blocks; identifying, in accordance with the time parameter for each unerased block in the set of blocks, garbage collection eligible blocks from among the first set of multiple blocks in accordance with a first threshold time, and identifying garbage collection eligible blocks from among the second set of multiple blocks in accordance with a second threshold time that is greater than the first threshold time; and selecting a subset of the set of garbage collection eligible blocks for garbage collection in accordance with predefined staleness criteria.
 11. The method of claim 10, wherein the storage medium comprises one or more flash memory devices.
 12. A device operable to perform garbage collection for a storage medium, the device comprising: a storage medium interface for coupling the device to the storage medium; and one or more modules, including a memory management module that includes one or more processors and memory storing one or more programs configured for execution by the one or more processors, the one or more modules coupled to the storage medium interface and configured to: determine a time parameter for each unerased block in a set of blocks in the storage medium, wherein the set of blocks includes a first set of multiple blocks and a second set of multiple blocks distinct from the first set of multiple blocks; identify, in accordance with the time parameter for each unerased block in the set of blocks, garbage collection eligible blocks from among the first set of multiple blocks in accordance with a first threshold time, and identify garbage collection eligible blocks from among the second set of multiple blocks in accordance with a second threshold time that is greater than the first threshold time; and select a subset of the set of garbage collection eligible blocks for garbage collection in accordance with predefined staleness criteria.
 13. The device of claim 12, wherein the garbage collection eligible blocks from among the first set of blocks are identified in accordance with a determination that the time parameter for the garbage collection eligible blocks is greater than the first threshold time.
 14. The device of claim 12, wherein the time parameter is a dwell time, the dwell time being a time since a last program command to modify data stored in the block.
 15. The device of claim 12, wherein the first threshold time is determined in accordance with one or more characteristics of the first set of multiple blocks.
 16. The device of claim 12, wherein determining the time parameter for the block includes determining a time when the block was last programmed.
 17. A device operable to perform garbage collection for a storage medium, the device comprising: a storage medium interface for coupling the device to the storage medium; and one or more modules, including a memory management module that includes one or more processors and memory storing one or more programs configured for execution by the one or more processors, the one or more modules coupled to the storage medium interface and configured to: select a first set of multiple blocks from the storage medium, wherein the storage system uses one or more parameter values to select blocks to include in the first set of multiple blocks; determine a threshold time for the first set of multiple blocks; for each block in the first set of multiple blocks, in accordance with a determination that a time parameter for the block is less than the determined threshold time, suspend garbage collection of the block for a remaining duration of the determined threshold time; and suspend, in succession, garbage collection of each set of blocks, in two or more other sets of blocks in the storage medium, for a respective threshold time, before suspending garbage collection of the first set of blocks again.
 18. The device of claim 17, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for a respective block, an error rate for the respective block, number of reads from the respective block, number of times the respective block has been programmed, number of times the respective block has been erased, a read scrub frequency for the respective block, a dynamic read frequency for the respective block, and a reading threshold voltage margin for the respective block.
 19. The device of claim 17, wherein the one or more modules are further configured to adapt the threshold time based on one or more parameter values of the set of blocks, wherein the one or more parameter values include at least one parameter in the set consisting of an error count for the set of blocks, an error rate for the set of blocks, number of reads from the set of blocks, number of times the set of blocks has been programmed, number of times the set of blocks has been erased, a read scrub frequency for the set of blocks, a dynamic read frequency for the set of blocks, and a reading threshold voltage margin for the set of blocks.
 20. The device of claim 12, wherein the storage medium comprises one or more flash memory devices.
 21. A device operable to perform garbage collection for a storage medium, the device comprising: a storage medium interface for coupling the device to the storage medium; and one or more modules, including a memory management module that includes one or more processors and memory storing one or more programs configured for execution by the one or more processors, the one or more modules coupled to the storage medium interface and configured to: determine a time parameter for a block in the storage medium; adapt a first threshold time based on one or more parameter values of the block; in accordance with a determination that the time parameter for the block is greater than the first threshold time, as adapted, enable garbage collection of the block; select a first set of multiple blocks from the storage medium; determine a second threshold time for the first set of multiple blocks, wherein the second threshold time is distinct from the first threshold time; and for each block in the first set of multiple blocks, in accordance with a determination that the time parameter for the block is less than the second threshold time, suspend garbage collection of the block for a remaining duration of the second threshold time. 